package com.photohistory.hibernate.beans;
// Generated 31.03.2010 12:15:52 by Hibernate Tools 3.2.4.GA


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * NaturalPhoto generated by hbm2java
 */
@Entity
@Table(name="natural_photo"
    ,catalog="mytest"
)
public class NaturalPhoto  implements java.io.Serializable {


     private int id;
     private City city;
     private Photo photo;
     private Country country;
     private Town town;
     private String name;

    public NaturalPhoto() {
    }

	
    public NaturalPhoto(Photo photo, String name) {
        this.photo = photo;
        this.name = name;
    }
    public NaturalPhoto(City city, Photo photo, Country country, Town town, String name) {
       this.city = city;
       this.photo = photo;
       this.country = country;
       this.town = town;
       this.name = name;
    }
   
     @GenericGenerator(name="generator", strategy="foreign", parameters=@Parameter(name="property", value="photo"))@Id @GeneratedValue(generator="generator")

    
    @Column(name="id", unique=true, nullable=false)
    public int getId() {
        return this.id;
    }
    
    public void setId(int id) {
        this.id = id;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="city_id")
    public City getCity() {
        return this.city;
    }
    
    public void setCity(City city) {
        this.city = city;
    }

@OneToOne(fetch=FetchType.LAZY)@PrimaryKeyJoinColumn
    public Photo getPhoto() {
        return this.photo;
    }
    
    public void setPhoto(Photo photo) {
        this.photo = photo;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="country_id")
    public Country getCountry() {
        return this.country;
    }
    
    public void setCountry(Country country) {
        this.country = country;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="town_id")
    public Town getTown() {
        return this.town;
    }
    
    public void setTown(Town town) {
        this.town = town;
    }

    
    @Column(name="name", nullable=false, length=256)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    public String toString(){
    	return name;
    }


}


